import matplotlib.pyplot as plt
import numpy as np

# 定义标准RGB颜色集
colors = [
    (1, 0, 0),    # Red
    (0, 1, 0),    # Green
    (0, 0, 1),    # Blue
    (1, 1, 0),    # Yellow
    (0, 1, 1),    # Cyan
    (1, 0, 1),    # Magenta
    (1, 1, 1),    # White
    (0, 0, 0),    # Black
    (0.5, 0.5, 0.5), # Gray
    (1, 0.5, 0),  # Orange
    (0.5, 0, 0.5), # Purple
    (0, 0.5, 0.5), # Teal
    (0.5, 0.5, 0), # Olive
    (0.5, 0, 0),   # Maroon
    (0, 0.5, 0),   # Lime
    (0, 0, 0.5),   # Navy
    (0.5, 0.25, 0), # Brown
    (0.25, 0.5, 0.5), # Turquoise
    (0.75, 0.75, 0.75), # Light Gray
    (0.25, 0.25, 0.25)  # Dark Gray
]

# 定义色卡的大小
num_colors = len(colors)
rows = int(np.ceil(np.sqrt(num_colors)))
cols = int(np.ceil(num_colors / rows))

# 创建一个空白图像
image = np.zeros((rows * 100, cols * 100, 3), dtype=np.uint8)

# 填充图像以创建色卡
for idx, color in enumerate(colors):
    row = idx // cols
    col = idx % cols
    image[row*100:(row+1)*100, col*100:(col+1)*100] = (np.array(color) * 255).astype(np.uint8)

# 显示图像
plt.figure(figsize=(10, 10))
plt.imshow(image)
plt.axis('off')  # 关闭坐标轴
plt.title('Standard RGB Color Chart')
plt.show()
